package 
{
	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;
	
	/**
	 * ...
	 * @author Lorenzo Nuvoletta
	 */
	public class Main extends Sprite 
	{
		private var loader:Loader;		
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);			
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			
			var ldrContext:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain); 
			
			loader = new Loader();
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, commonLoaded);
			loader.load(new URLRequest("Commons.swf"), ldrContext);			
		}
		
		private function commonLoaded(e:Event):void {			
			loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, commonLoaded);
			startUp();
		}
		
		private function startUp():void {
			var symbol1:Symbol1 = new Symbol1();
			addChild(symbol1);
			symbol1.a.stop();			
			var btn:ButtonMC = new ButtonMC();			
			addChild(btn);
			btn.gotoAndStop(3);
		}
		
	}
	
}